﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace NFLDriver
{
    //Represents all the games in a season via a 2 dimensional array
    public class Schedule
    {
        //all the games in the season as arranged by [week, gameNumber]
        private Match[,] schedule = new Match[17, 16];
        public Schedule()
        {
        }

        public void setMatch(int week, int gameNumber, Match match)
        {
            if ((week < 17) && (week >= 0))
            {
                if ((gameNumber < 17) && (gameNumber >= 0))
                {
                    schedule[week, gameNumber] = match;
                }
                else
                {
                    MessageBox.Show("Invalid parameter in Schedule.setMatch\ngameNumber = " + gameNumber, "Invalid Parameter", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Invalid parameter in Schedule.setMatch\nweek = " + week, "Invalid Parameter", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        public Match getMatch(int week, int gameNumber)
        {
            if ((week < 17) && (week >= 0))
            {
                if ((gameNumber < 17) && (gameNumber >= 0))
                {
                    return schedule[week, gameNumber];
                }
                else
                {
                    MessageBox.Show("Invalid parameter in Schedule.getMatch\ngameNumber = " + gameNumber, "Invalid Parameter", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return null;
                }
            }
            else
            {
                MessageBox.Show("Invalid parameter in Schedule.getMatch\nweek = " + week, "Invalid Parameter", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return null;
            }
        }

    }
}
